package fr.esiag.isidis.pdsTeam.Test;



import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.ObjectMessage;

import com.esiag.isidis.fi.pdsTeam.jms.consumer.ActiveMQConsumer;
import com.esiag.isidis.fi.pdsTeam.receive.beans.Action;
import com.esiag.isidis.fi.pdsTeam.send.beans.Information;


public class ReciverManager extends ActiveMQConsumer{
	public ReciverManager(Class msgClass) {
		super(msgClass);
	}
	public void onMessage(Message msg) {
		if(msg instanceof ObjectMessage){
			ObjectMessage ObjMsg = (ObjectMessage)msg;
			try {
				Information info = (Information) ObjMsg.getObject();
				System.out.println(info);
			    try{
					Thread.sleep(5000);
				}catch(Exception ex){
					ex.printStackTrace();
				}
				System.out.println("traintement fini");
			} catch (JMSException e) {
				e.printStackTrace();
			}
		}	
	}
	public static void main(String[] args) {
		new ReciverManager(Information.class);
	}
}
